package com.work.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Date;
import java.util.List;


/**
 * The persistent class for the Releases database table.
 * 
 */
@Entity
@NamedQuery(name="Releases.findAll", query="SELECT r FROM Releases r")
public class Releases implements Serializable {
	private static final long serialVersionUID = 1L;
	private int idReleases;
	private Date codeFreeze;
	private Date creationDate;
	private int releaseNb;
	private String releasePhase;
	private Date updatedDate;
	private String year;
	private List<Codereview> codeReviews;
	private User userCreatedBy;
	private User userUpdatedBy;

	public Releases() {
	}


	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public int getIdReleases() {
		return this.idReleases;
	}

	public void setIdReleases(int idReleases) {
		this.idReleases = idReleases;
	}


	@Temporal(TemporalType.TIMESTAMP)
	public Date getCodeFreeze() {
		return this.codeFreeze;
	}

	public void setCodeFreeze(Date codeFreeze) {
		this.codeFreeze = codeFreeze;
	}


	@Temporal(TemporalType.TIMESTAMP)
	public Date getCreationDate() {
		return this.creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}


	public int getReleaseNb() {
		return this.releaseNb;
	}

	public void setReleaseNb(int releaseNb) {
		this.releaseNb = releaseNb;
	}


	public String getReleasePhase() {
		return this.releasePhase;
	}

	public void setReleasePhase(String releasePhase) {
		this.releasePhase = releasePhase;
	}


	@Temporal(TemporalType.TIMESTAMP)
	public Date getUpdatedDate() {
		return this.updatedDate;
	}

	public void setUpdatedDate(Date updatedDate) {
		this.updatedDate = updatedDate;
	}


	public String getYear() {
		return this.year;
	}

	public void setYear(String year) {
		this.year = year;
	}


	//bi-directional many-to-one association to CodeReview
	@OneToMany(mappedBy="releas")
	public List<Codereview> getCodeReviews() {
		return this.codeReviews;
	}

	public void setCodeReviews(List<Codereview> codeReviews) {
		this.codeReviews = codeReviews;
	}

	public Codereview addCodeReview(Codereview codeReview) {
		getCodeReviews().add(codeReview);
		codeReview.setReleas(this);

		return codeReview;
	}

	public Codereview removeCodeReview(Codereview codeReview) {
		getCodeReviews().remove(codeReview);
		codeReview.setReleas(null);

		return codeReview;
	}


	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="createdBy")
	public User getUserCreatedBy() {
		return this.userCreatedBy;
	}

	public void setUserCreatedBy(User userCreatedBy) {
		this.userCreatedBy = userCreatedBy;
	}


	//bi-directional many-to-one association to User
	@ManyToOne
	@JoinColumn(name="updateBy")
	public User getUserUpdatedBy() {
		return this.userUpdatedBy;
	}

	public void setUserUpdatedBy(User userUpdatedBy) {
		this.userUpdatedBy = userUpdatedBy;
	}

}